package com.docking.heylo.web.controller;

import com.docking.heylo.service.ISysUserService;
import com.docking.heylo.web.dto.SysUserDto;
import com.docking.heylo.web.utils.ResultUtil;
import com.docking.heylo.web.vo.BaseVo;
import com.docking.heylo.web.vo.LoginResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class LoginController {

    @Autowired
    private ISysUserService sysUserService;

    /***
     * 登录
     *
     * @param userDto
     * @return
     */
    @PostMapping("/login")
    public BaseVo login(@RequestBody @Validated(SysUserDto.Login.class) SysUserDto userDto){
        LoginResult result = sysUserService.login(userDto);
        return ResultUtil.success("登陆成功", result);
    }











}
